import request from './request'
const post = (url, data = {}) =>
  request.post(
    url,
    data
  )
const get = (url, params = {}) =>
  request.get(
    url,
    params
  )

// 接口说明
//客户主数据
const mdmIndex = () => get('mdm/')
const facInfo = facId => get(`mdm/${facId}`)
const facInfoByName = fac => post(`mdm/facByName`,{fac})
const summaryType = (facId, typeCode) => get(`mdm/${facId}/byType/${typeCode}`)
const summaryProvince = (facId, typeCode) => get(`mdm/${facId}/byProvince/${typeCode}`)
const summaryProvincePost = (facId, typeCode,bigType) => post('mdm/byProvince',{
  facId,typeCode,bigType
})

//安捷力主数据
const ascIndex = () => get('mdm/asc')
const ascNameSummary = (typeCode) => get(`mdm/asc/ascName/${typeCode}`)
const ascNameSummaryProvince = (typeCode, bigType) => post(`mdm/asc/ascNameByProvince`,{typeCode, bigType})
const ascNameTotal = (typeCode) => get(`mdm/asc/ascNameTotal/${typeCode}`)

const ascTypeDetail = () => get('mdm/asc/detail')

//清洗型客户
const cleanByType = (fac) => post('/mdm/clean/byType',{fac})
const cleanByProvince = (fac) => post('/mdm/clean/byProvince',{fac})

//接口导出
export {
  mdmIndex,
  facInfo,
  summaryType,
  summaryProvince,
  summaryProvincePost,
  ascIndex,
  ascNameSummary,
  ascNameSummaryProvince,
  ascNameTotal,
  ascTypeDetail,
  cleanByType,
  cleanByProvince,
  facInfoByName
}
